﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Roton.ZZT
{
    /// <summary>
    /// Interface for global variables.
    /// </summary>
    interface IState
    {
        /// <summary>
        /// If true, the About box has been shown.
        /// </summary>
        bool AboutShown { get; set; }

        /// <summary>
        /// Index of the thing to execute.
        /// </summary>
        int ActIndex { get; set; }

        /// <summary>
        /// If true, alert is enabled for ammo pickups.
        /// </summary>
        bool AlertAmmo { get; set; }

        /// <summary>
        /// If true, alert is enabled when entering a dark board.
        /// </summary>
        bool AlertDark { get; set; }

        /// <summary>
        /// If true, alert is enabled for energizer pickups.
        /// </summary>
        bool AlertEnergy { get; set; }

        /// <summary>
        /// If true, alert is enabled for stepping through a fake wall.
        /// </summary>
        bool AlertFake { get; set; }

        /// <summary>
        /// If true, alert is enabled for walking through a forest.
        /// </summary>
        bool AlertForest { get; set; }

        /// <summary>
        /// If true, alert is enabled for gem pickups.
        /// </summary>
        bool AlertGem { get; set; }

        /// <summary>
        /// If true, alert is enabled for attempting to shoot while out of ammo.
        /// </summary>
        bool AlertNoAmmo { get; set; }

        /// <summary>
        /// If true, alert is enabled for attempting to shoot on a board with 0 max shots.
        /// </summary>
        bool AlertNoShoot { get; set; }

        /// <summary>
        /// If true, alert is enabled for attempting to use a torch on a board that is not dark.
        /// </summary>
        bool AlertNotDark { get; set; }

        /// <summary>
        /// If true, alert is enabled for attempting to use a torch while having 0 torches.
        /// </summary>
        bool AlertNoTorch { get; set; }

        /// <summary>
        /// If true, alert is enabled for torch pickups.
        /// </summary>
        bool AlertTorch { get; set; }

        /// <summary>
        /// Number of boards, excluding the title screen.
        /// </summary>
        int BoardCount { get; set; }

        /// <summary>
        /// The color used for border tiles on a new board.
        /// </summary>
        int BorderColor { get; set; }

        /// <summary>
        /// The ID used for border tiles on a new board.
        /// </summary>
        int BorderID { get; set; }

        /// <summary>
        /// If true, indicates the game loop should be terminated.
        /// </summary>
        bool BreakGameLoop { get; set; }

        /// <summary>
        /// If true, the player pressed ESC when a scroll was up.
        /// </summary>
        bool CancelScroll { get; set; }

        /// <summary>
        /// Default filename used by the editor for transferring boards.
        /// </summary>
        IString DefaultBoardName { get; }

        /// <summary>
        /// Default filename used for saving games.
        /// </summary>
        IString DefaultSaveName { get; }

        /// <summary>
        /// Default filename used for saving worlds.
        /// </summary>
        IString DefaultWorldName { get; }

        /// <summary>
        /// The color used for edge tiles.
        /// </summary>
        int EdgeColor { get; set; }

        /// <summary>
        /// The ID used for edge tiles.
        /// </summary>
        int EdgeID { get; set; }

        /// <summary>
        /// If true, the editor is active.
        /// </summary>
        bool EditorMode { get; set; }

        /// <summary>
        /// Increments on each board cycle.
        /// </summary>
        int GameCycle { get; set; }

        /// <summary>
        /// If true, the player has died.
        /// </summary>
        bool GameOver { get; set; }

        /// <summary>
        /// If true, the game is paused.
        /// </summary>
        bool GamePaused { get; set; }

        /// <summary>
        /// If true, sound playback is silenced.
        /// </summary>
        bool GameQuiet { get; set; }

        /// <summary>
        /// Game speed. Lower numbers are faster and 0 is unrestricted.
        /// </summary>
        int GameSpeed { get; set; }

        /// <summary>
        /// Time in ticks to wait between executing board Things.
        /// </summary>
        int GameWaitTime { get; set; }

        /// <summary>
        /// If true, the game loop data must be initialized.
        /// </summary>
        bool Init { get; set; }

        /// <summary>
        /// If true, an arrow key is pressed.
        /// </summary>
        bool KeyArrow { get; set; }

        /// <summary>
        /// Contains the character pressed.
        /// </summary>
        byte KeyPressed { get; set; }

        /// <summary>
        /// If true, the shift key is pressed.
        /// </summary>
        bool KeyShift { get; set; }

        /// <summary>
        /// Retrieves a Vector that contains [KeyVectorX,KeyVectorY].
        /// </summary>
        IVector KeyVector { get; }

        /// <summary>
        /// X-vector of the arrow key being pressed.
        /// </summary>
        int KeyVectorX { get; set; }

        /// <summary>
        /// Y-vector of the arrow key being pressed.
        /// </summary>
        int KeyVectorY { get; set; }

        /// <summary>
        /// String containing each line character.
        /// </summary>
        IString LineChars { get; }

        /// <summary>
        /// String containing the onscreen message.
        /// </summary>
        IString Message { get; }

        /// <summary>
        /// Character value used by OOP execution code.
        /// </summary>
        byte OOPByte { get; set; }

        /// <summary>
        /// Integer value used by OOP execution code.
        /// </summary>
        int OOPNumber { get; set; }

        /// <summary>
        /// String value used by OOP execution code.
        /// </summary>
        IString OOPWord { get; }

        /// <summary>
        /// The element ID to use for the player.
        /// </summary>
        int PlayerElement { get; set; }

        /// <summary>
        /// If true, indicates the engine should end execution.
        /// </summary>
        bool QuitZZT { get; set; }

        /// <summary>
        /// Sounds currently in the buffer.
        /// </summary>
        IString SoundBuffer { get; }

        /// <summary>
        /// If true, a sound is currently playing.
        /// </summary>
        bool SoundPlaying { get; set; }

        /// <summary>
        /// Contains the sound priority.
        /// </summary>
        int SoundPriority { get; set; }

        /// <summary>
        /// Number of ticks remaining on the current sound.
        /// </summary>
        int SoundTicks { get; set; }

        /// <summary>
        /// String containing each star character.
        /// </summary>
        IString StarChars { get; }

        /// <summary>
        /// Index of the board to start the game on.
        /// </summary>
        int StartBoard { get; set; }

        /// <summary>
        /// The maximum index of Things on the board. If 0, only the player exists.
        /// </summary>
        int ThingCount { get; set; }

        /// <summary>
        /// String containing each horizontal transporter character.
        /// </summary>
        IString TransporterHChars { get; }

        /// <summary>
        /// String containing each vertical transporter character.
        /// </summary>
        IString TransporterVChars { get; }

        /// <summary>
        /// X vector from the 4-direction table.
        /// </summary>
        /// <param name="index">Index of the vector.</param>
        int Vector4X(int index);

        /// <summary>
        /// Y vector from the 4-direction table.
        /// </summary>
        /// <param name="index">Index of the vector.</param>
        int Vector4Y(int index);

        /// <summary>
        /// X vector from the 8-direction table.
        /// </summary>
        /// <param name="index">Index of the vector.</param>
        int Vector8X(int index);

        /// <summary>
        /// Y vector from the 8-direction table.
        /// </summary>
        /// <param name="index">Index of the vector.</param>
        int Vector8Y(int index);

        /// <summary>
        /// Number of visible tiles on a board.
        /// </summary>
        int VisibleTileCount { get; set; }

        /// <summary>
        /// String containing each web character.
        /// </summary>
        IString WebChars { get; }

        /// <summary>
        /// File name for the current world.
        /// </summary>
        IString WorldFileName { get; }

        /// <summary>
        /// If true, a world is currently loaded.
        /// </summary>
        bool WorldLoaded { get; set; }
    }
}
